<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core">

	<ui:define name="layoutCenter">
		<h:form>
			<p:growl id="msgResultado" showDetail="true"/>
			<p:breadCrumb>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.home')}" url="/home.xhtml"/>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.service')}" url="/crud/service/serviceList.xhtml"/>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.editar')}" url="/crud/service/serviceLogList.xhtml"/>
			</p:breadCrumb>			
			<p:tabView  id="tabView" orientation="top" effect="slide">
				<p:tab title="Servico">
					<ui:include src="/WEB-INF/elements/formService.xhtml" />
				</p:tab>
		
				<p:tab title="Anotacoes">
					<h:panelGrid columns="2">

						<h:outputLabel value="Annotation"/>
						<p:editor id="dsServiceAnnotation" value="#{serviceBean.service.annotation}" />
					</h:panelGrid>
						<h:inputHidden id="idServiceAnnotation" value="#{serviceBean.serviceAnnotation.dsServiceAnnotation}" />
						<h:inputHidden id="nrVersionAnnotatio" value="#{serviceBean.serviceAnnotation.nrVersion}" />
				</p:tab>
				<p:tab title="Historico">
					<p:dataTable id="serviceLogs" var="serviceLog" value="#{serviceBean.servicesLogs}">
						
						<p:column style="width:4%">  
            				<p:rowToggler />  
        				</p:column>  
						<p:column id="user" headerText="Usuario">				
							<h:outputText value="#{serviceLog.user}"/>	
						</p:column>
						<p:column id="cdServiceSituation" headerText="Situacao do servico">				
							<h:outputText value="#{serviceLog.serviceSituation.cdServiceSituation}"/>	
						</p:column>
						<p:column id="dtBegin" headerText="Data Inicio">				
							<h:outputText value="#{serviceLog.dtBegin}"/>	
						</p:column>
						<p:column id="dtEnd" headerText="Data Fim">				
							<h:outputText value="#{serviceLog.dtEnd}"/>	
						</p:column>
						<p:rowExpansion  >  	
							<p:dataTable id="serviceAnnotationGrid" var="serviceAnnotation" value="#{serviceBean.serviceLog.serviceAnnotation}">
								<p:column>
									<h:outputText value="#{serviceAnnotation.user.cdUser}" />
								</p:column>
								<p:column>
									<h:outputText value="#{serviceAnnotation.dsServiceAnnotation}" />
								</p:column>
							</p:dataTable>
						</p:rowExpansion>
					</p:dataTable>
				</p:tab>
			</p:tabView>
			<p:panel style="text-align:center">
				<p:commandButton id="btSub" value="#{lang.getTrans('ui.mobile.common.save')}"
					 action="#{serviceBean.adicionar}" />
				<p:button value="#{lang.getTrans('ui.mobile.common.cancel')}" outcome="serviceList" />
			</p:panel>		
		</h:form>			

	</ui:define>
</ui:composition>